Skip to content

test(test-runner): migrate integration tests from mocha/chai to node:test#3099

Open
bennypowers wants to merge 9 commits into
masterfrom
migrate/test-runner-integration-node-test
Open

test(test-runner): migrate integration tests from mocha/chai to node:test#3099
bennypowers wants to merge 9 commits into
masterfrom
migrate/test-runner-integration-node-test

Conversation

@bennypowers

Copy link
Copy Markdown
Member

Summary

  • Migrate shared integration/test-runner/ framework (7 test helper files, 567 lines) from mocha/chai to node:test/node:assert/strict
  • Migrate test-runner-chrome, test-runner-playwright, test-runner-puppeteer test wrappers
  • All four must migrate together since the wrappers import from the shared framework

Changes per component

integration/test-runner/ (shared framework):

  • chai assertions to node:assert/strict
  • Mocha globals (describe/before/it) to explicit node:test imports
  • __dirname to import.meta.dirname
  • Internal .js imports to .ts for strip-types compatibility
  • Test script: mocha to node --experimental-strip-types --test

test-runner-chrome/playwright/puppeteer (wrappers):

  • this.timeout(N) to describe('...', { timeout: N }, () => ...)
  • ../src/index.js to ../dist/index.js
  • Integration import uses .ts extension
  • Test scripts: mocha to node --experimental-strip-types --test

No published code changes

All packages' src/ directories are untouched. Only test files and test scripts changed.

Test plan

  • test-runner-chrome: 22/22 pass locally
  • test-runner-puppeteer: 22/22 pass locally
  • test-runner-playwright chromium: pass locally
  • test-runner-playwright firefox: pass locally
  • test-runner-playwright webkit: known local failure (missing system libs), passes in CI
  • CI green

…test

Migrate the shared integration test framework and all three browser
launcher test wrappers (chrome, playwright, puppeteer) from mocha/chai
to node:test/node:assert/strict.

Changes:
- integration/test-runner: chai assertions to node:assert, mocha
  globals to node:test imports, `__dirname` to `import.meta.dirname`,
  internal imports use .ts extension for strip-types
- test-runner-chrome: this.timeout to describe options, src -> dist
  imports, integration import uses .ts extension
- test-runner-playwright: same as chrome
- test-runner-puppeteer: same as chrome
- All test scripts: mocha -> node --experimental-strip-types --test

No published code changes. All packages' src/ directories are untouched.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 48d4ef9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

bennypowers and others added 4 commits June 3, 2026 00:09
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ntegration tests

Add local expectIncludes helper to replace assert.ok(x.includes(y))
for better error messages on failure.

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread integration/test-runner/package.json Outdated
@bashmish

Copy link
Copy Markdown
Member

I also migrated

  • packages/test-runner-browserstack
  • packages/test-runner-saucelabs
  • packages/test-runner-selenium
  • packages/test-runner-webdriver

On top of that, running the tests for them was not enabled, because "test:node" wasn't defined. My change also will now run those tests. I was able to verify test-runner-selenium and test-runner-webdriver, but not test-runner-browserstack and test-runner-saucelabs which require a connection to remote server.

@bashmish

bashmish commented Jun 17, 2026

Copy link
Copy Markdown
Member

The tests of test-runner-browserstack and test-runner-saucelabs also fail in the pipeline due to a lack of auth.
https://github.com/modernweb-dev/web/actions/runs/27695128041/job/81916155080?pr=3099

I will disable them again now by removing "test:node". Looks like it's an issue since a long time ago, in general these packages were not tested for a long time and we need to look into solving it.

@bashmish bashmish force-pushed the migrate/test-runner-integration-node-test branch from 6f94032 to 6f3301d Compare June 17, 2026 14:31
@bashmish bashmish force-pushed the migrate/test-runner-integration-node-test branch from 6f3301d to 48d4ef9 Compare June 17, 2026 14:42
@bashmish

bashmish commented Jun 17, 2026

Copy link
Copy Markdown
Member

@bennypowers I made significant changes in the PR, see my comments above, last commits and let me know please if you are OK with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants